package com.dongdongshop.service;

import com.dongdongshop.mapper.TbContentCategoryMapper;
import com.dongdongshop.pojo.TbContentCategory;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@DubboService
public class TbContentCategoryServiceImpl implements TbContentCategoryService {

    @Autowired
    private TbContentCategoryMapper tbContentCategoryMapper;

    @Override
    public List<TbContentCategory> selectAll(TbContentCategory tbContentCategory) {
        List<TbContentCategory> tbContentCategories = tbContentCategoryMapper.selectByName(tbContentCategory);
        return tbContentCategories;
    }

    @Override
    public boolean insert(TbContentCategory tbContentCategory) {
        int i = tbContentCategoryMapper.insert(tbContentCategory);
        return i>0;
    }

    @Override
    public TbContentCategory selectById(Long id) {
        TbContentCategory tbContentCategory = tbContentCategoryMapper.selectByPrimaryKey(id);
        return tbContentCategory;
    }

    @Override
    public boolean updateById(TbContentCategory tbContentCategory) {
        int i = tbContentCategoryMapper.updateByPrimaryKey(tbContentCategory);
        return i>0;
    }

    @Override
    public boolean deleteByIds(Integer[] ids) {
        int i = tbContentCategoryMapper.deleteByIds(ids);
        return i>0;
    }

    @Override
    public List<TbContentCategory> selectByAll() {
        List<TbContentCategory> tbContentCategories = tbContentCategoryMapper.selectByExample(null);
        return tbContentCategories;
    }
}
